<template>
  <div class="app-container">    
    <el-table  :data="dataList" v-if="dataList && dataList.length > 0" :row-class-name="tableRowClassName">
      <el-table-column type="index" width="55" label="序号" align="center" />
      <el-table-column label="名称" align="center" prop="title"/>
      <el-table-column label="时间" align="center" prop="get_time"/>
    </el-table>
    <el-alert :closable="false" title="暂无数据"  type="warning" v-else></el-alert>
  </div>
</template>

<script>
import { apiDs } from "@/api/openapi";

export default {
  name: "SchoolGlory",
  dicts: [],
  data() {
    return {
      dataList: []
    };
  },
  created() {
    apiDs('home_statics_glory').then((response) => {
        this.dataList = response.data;
    });
  },
  methods: {
    tableRowClassName({row, rowIndex}) {
      if (rowIndex === 1) {
        return 'warning-row';
      } else if (rowIndex === 3) {
        return 'success-row';
      }
      return '';
    }
  }
};
</script>
<style>
  .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }
</style>
